package com.zhong.kotlin.mvp.activity

import android.os.Bundle
import android.widget.Button
import android.widget.TextView
import com.zhong.kotlin.R
import com.zhong.kotlin.base.BaseActivity
import com.zhong.kotlin.mvp.contact.TestContact
import com.zhong.kotlin.mvp.presenter.TestPresenter

class TestActivity : BaseActivity<TestContact.presenter>(), TestContact.view {
    override fun setData(data: String) {
        val textView = findViewById(R.id.text) as TextView
        textView.text = data
    }


    override fun initPresenter(): TestContact.presenter {
        return TestPresenter(this)
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_test)

        button.setOnClickListener({
            presenter!!.getData()
        })

    }

    val button: Button by lazy {
        findViewById(R.id.button) as Button//变量第一次使用时执行初始化
    }
}


